package com.ssy.lingxi.member.merchant.controller.web;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.member.merchant.model.vo.basic.request.NamePageVO;
import com.ssy.lingxi.member.merchant.model.vo.lifecycle.request.*;
import com.ssy.lingxi.member.merchant.model.vo.lifecycle.response.*;
import com.ssy.lingxi.member.merchant.service.web.IMemberComplaintService;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu 会员能力 - 投诉建议
 * @author yzc
 * @version 2.0.0
 * @date 2021/5/18
 */
@RestController
@RequestMapping("/member/complaint")
public class MemberComplaintController {

    @Resource
    private IMemberComplaintService memberComplaintService;

    /**
     * 状态下拉查询
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/statusList", method = RequestMethod.GET)
    public Wrapper<List<StatusVO>> listMemberComplaintStatus(@RequestHeader HttpHeaders headers) {
        return memberComplaintService.listMemberComplaintStatus(headers);
    }

    /**
     * 投诉建议 - 分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/upper/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberUpperComplaintPageQueryVO>> pageMemberComplaint(@RequestHeader HttpHeaders headers, @Valid MemberComplaintPageVO queryVO) {
        return memberComplaintService.pageUpperMemberComplaint(headers, queryVO);
    }

    /**
     * 投诉建议 - 详情
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/upper/get", method = RequestMethod.GET)
    public Wrapper<MemberComplaintUpperVO> getMemberComplaintResult(@RequestHeader HttpHeaders headers, @Valid CommonIdVO idVO) {
        return memberComplaintService.getUpperMemberComplaint(headers, idVO);
    }

    /**
     * 投诉建议 - 新增
     * @param headers Http头部信息
     * @param addVO 接口参数
     */
    @RequestMapping(value = "/upper/add", method = RequestMethod.POST)
    public Wrapper<Void> addMemberComplaint(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberComplaintUpperAddVO addVO) {
        return memberComplaintService.addUpperMemberComplaint(headers, addVO);
    }

    /**
     * 投诉建议 - 修改
     * @param headers Http头部信息
     * @param addVO 接口参数
     */
    @RequestMapping(value = "/upper/update", method = RequestMethod.POST)
    public Wrapper<Void> updateMemberComplaint(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberComplaintUpperUpdateVO addVO) {
        return memberComplaintService.updateUpperMemberComplaint(headers, addVO);
    }

    /**
     * 投诉建议 - 删除
     * @param headers Http头部信息
     * @param idVO 接口参数
     */
    @RequestMapping(value = "/upper/delete", method = RequestMethod.POST)
    public Wrapper<Void> addMemberComplaint(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonIdVO idVO) {
        return memberComplaintService.deleteMemberComplaint(headers, idVO);
    }

    /**
     * 投诉建议 - 提交
     * @param headers Http头部信息
     * @param idVO 接口参数
     */
    @RequestMapping(value = "/upper/submit", method = RequestMethod.POST)
    public Wrapper<Void> submitMemberComplaint(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonIdVO idVO) {
        return memberComplaintService.submitMemberComplaint(headers, idVO);
    }

    /**
     * 投诉建议 - 处理
     * @param headers Http头部信息
     * @param handleVO 接口参数
     */
    @RequestMapping(value = "/upper/send", method = RequestMethod.POST)
    public Wrapper<Void> handleMemberComplaint(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberComplaintHandleVO handleVO) {
        return memberComplaintService.handleMemberComplaint(headers, handleVO);
    }

    /**
     * 投诉建议新增 - 选择上级会员
     * @param headers Http头部信息
     * @param pageVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/sub/members", method = RequestMethod.GET)
    public Wrapper<PageData<UpperMemberQueryVO>> pageMembers(@RequestHeader HttpHeaders headers, @Valid NamePageVO pageVO) {
        return memberComplaintService.pageMembers(headers, pageVO);
    }

    /**
     * 投诉建议管理 - 分页列表
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/sub/page", method = RequestMethod.GET)
    public Wrapper<PageData<MemberSubComplaintPageQueryVO>> pageSubMemberComplaint(@RequestHeader HttpHeaders headers, @Valid MemberComplaintPageVO queryVO) {
        return memberComplaintService.pageSubMemberComplaint(headers, queryVO);
    }

    /**
     * 投诉建议管理 - 详情
     * @param headers Http头部信息
     * @return 查询结果
     */
    @RequestMapping(value = "/sub/get", method = RequestMethod.GET)
    public Wrapper<MemberComplaintSubVO> getSubMemberComplaint(@RequestHeader HttpHeaders headers, @Valid CommonIdVO idVO) {
        return memberComplaintService.getSubMemberComplaint(headers, idVO);
    }

    /**
     * 投诉建议管理 - 新增
     * @param headers Http头部信息
     * @param addVO 接口参数
     */
    @RequestMapping(value = "/sub/add", method = RequestMethod.POST)
    public Wrapper<Void> addMemberComplaint(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberComplaintSubAddVO addVO) {
        return memberComplaintService.addSubMemberComplaint(headers, addVO);
    }

    /**
     * 投诉建议管理 - 修改
     * @param headers Http头部信息
     * @param addVO 接口参数
     */
    @RequestMapping(value = "/sub/update", method = RequestMethod.POST)
    public Wrapper<Void> updateMemberComplaint(@RequestHeader HttpHeaders headers, @RequestBody @Valid MemberComplaintSubUpdateVO addVO) {
        return memberComplaintService.updateSubMemberComplaint(headers, addVO);
    }

    /**
     * 投诉建议管理 - 删除
     * @param headers Http头部信息
     * @param idVO 接口参数
     */
    @RequestMapping(value = "/sub/delete", method = RequestMethod.POST)
    public Wrapper<Void> deleteMemberComplaint(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonIdVO idVO) {
        return memberComplaintService.deleteMemberComplaint(headers, idVO);
    }

    /**
     * 投诉建议管理 - 提交
     * @param headers Http头部信息
     * @param idVO 接口参数
     */
    @RequestMapping(value = "/sub/submit", method = RequestMethod.POST)
    public Wrapper<Void> submitSubMemberComplaint(@RequestHeader HttpHeaders headers, @RequestBody @Valid CommonIdVO idVO) {
        return memberComplaintService.submitMemberComplaint(headers, idVO);
    }
}
